setwd("###The directory for all the replicaateion files on your computer###")
sink("Vuong_R_Replication.txt", append=FALSE, split=FALSE)

# Replication for "Self-Centered Inequity Aversion and the Mass Politics of Taxation"
# Published in Comparative Political Studies 										  
# This files use R for Vuong tests for model selection in Table A-11 
# Xiaobo Lu  and Ken Scheve   
# July 8,  2016             



library(foreign)
library(car)
library(MASS)

# Load Kevin Clarke's R code to do the test 
source("Modsel.R")

# Vuong tests for US data 
USdata <- read.dta("US_final_replication.dta")
attach(USdata)


# Deficit Reduction experiment 
# US Panel 

# Artificial gap of X_i-X_j>5000 & X_j-X_i>5000
alt_DEF_gap_5000_3 <-glm(deficittaxop1~alphincDEFd2_5000+betaincDEFd2_5000+DEFi1_5000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
org_DEF_3 <-glm(deficittaxop1~alphincDEFd2+betaincDEFd2+DEFi1+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_5000_3 <- mod.sel(org_DEF_3,alt_DEF_gap_5000_3)
summary(vuong_5000_3)


# Artificial gap of X_i-X_j>10000 & X_j-X_i>10000
alt_DEF_gap_10000_3 <-glm(deficittaxop1~alphincDEFd2_10000+betaincDEFd2_10000+DEFi1_10000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_10000_3 <- mod.sel(org_DEF_3,alt_DEF_gap_10000_3)
summary(vuong_10000_3)


# Artificial gap of X_i-X_j>15000 & X_j-X_i>15000
alt_DEF_gap_15000_3 <-glm(deficittaxop1~alphincDEFd2_15000+betaincDEFd2_15000+DEFi1_15000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_15000_3 <- mod.sel(org_DEF_3,alt_DEF_gap_15000_3)
summary(vuong_15000_3)


# Artificial gap of X_i-X_j>20000 & X_j-X_i>20000
alt_DEF_gap_20000_3 <-glm(deficittaxop1~alphincDEFd2_20000+betaincDEFd2_20000+DEFi1_20000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_20000_3 <- mod.sel(org_DEF_3,alt_DEF_gap_20000_3)
summary(vuong_20000_3)

# Artificial gap of X_i-X_j>25000 & X_j-X_i>25000
alt_DEF_gap_25000_3 <-glm(deficittaxop1~alphincDEFd2_25000+betaincDEFd2_25000+DEFi1_25000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_25000_3 <- mod.sel(org_DEF_3,alt_DEF_gap_25000_3)
summary(vuong_25000_3)



# Progessive tax share experiment 
# US Panel 

# Artificial gap of X_i-X_j>5000 & X_j-X_i>5000
alt_TSH_gap_5000_3 <-glm(taxshareop1_d~alphincTSHd2_5000+betaincTSHd2_5000+TSHi1_5000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
org_TSH_3 <-glm(taxshareop1_d~alphincTSHd2+betaincTSHd2+TSHi1+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_5000_3 <- mod.sel(org_TSH_3,alt_TSH_gap_5000_3)
summary(vuong_5000_3)


# Artificial gap of X_i-X_j>10000 & X_j-X_i>10000
alt_TSH_gap_10000_3 <-glm(taxshareop1_d~alphincTSHd2_10000+betaincTSHd2_10000+TSHi1_10000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_10000_3 <- mod.sel(org_TSH_3,alt_TSH_gap_10000_3)
summary(vuong_10000_3)


# Artificial gap of X_i-X_j>15000 & X_j-X_i>15000
alt_TSH_gap_15000_3 <-glm(taxshareop1_d~alphincTSHd2_15000+betaincTSHd2_15000+TSHi1_15000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_15000_3 <- mod.sel(org_TSH_3,alt_TSH_gap_15000_3)
summary(vuong_15000_3)


# Artificial gap of X_i-X_j>20000 & X_j-X_i>20000
alt_TSH_gap_20000_3 <-glm(taxshareop1_d~alphincTSHd2_20000+betaincTSHd2_20000+TSHi1_20000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_20000_3 <- mod.sel(org_TSH_3,alt_TSH_gap_20000_3)
summary(vuong_20000_3)

# Artificial gap of X_i-X_j>25000 & X_j-X_i>25000
alt_TSH_gap_25000_3 <-glm(taxshareop1_d~alphincTSHd2_25000+betaincTSHd2_25000+TSHi1_25000+collegegradp+female+ageyears+factor(state),data=USdata,family=binomial(link=probit))
vuong_25000_3 <- mod.sel(org_TSH_3,alt_TSH_gap_25000_3)
summary(vuong_25000_3)



# Vuong tests for French data 
Frenchdata <- read.dta("French_final_replication.dta")
attach(Frenchdata)

# Deficit Reduction experiment 
# France Panel 

# Artificial gap of X_i-X_j>500 & X_j-X_i>500 
alt_DEF_gap_500_3 <-glm(deficittaxop1~alphincDEFd2_500+betaincDEFd2_500+DEFi1_500+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
org_DEF_3 <-glm(deficittaxop1~alphincDEFd2+betaincDEFd2+DEFi1+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_500_3 <- mod.sel(org_DEF_3,alt_DEF_gap_500_3)
summary(vuong_500_3)


# Artificial gap of X_i-X_j>750 & X_j-X_i>750 
alt_DEF_gap_750_3 <-glm(deficittaxop1~alphincDEFd2_750+betaincDEFd2_750+DEFi1_750+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_750_3 <- mod.sel(org_DEF_3,alt_DEF_gap_750_3)
summary(vuong_750_3)


# Artificial gap of X_i-X_j>1000 & X_j-X_i>1000 
alt_DEF_gap_1000_3 <-glm(deficittaxop1~alphincDEFd2_1000+betaincDEFd2_1000+DEFi1_1000+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1000_3 <- mod.sel(org_DEF_3,alt_DEF_gap_1000_3)
summary(vuong_1000_3)


# Artificial gap of X_i-X_j>1250 & X_j-X_i>1250 
alt_DEF_gap_1250_3 <-glm(deficittaxop1~alphincDEFd2_1250+betaincDEFd2_1250+DEFi1_1250+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1250_3 <- mod.sel(org_DEF_3,alt_DEF_gap_1250_3)
summary(vuong_1250_3)

# Artificial gap of X_i-X_j>1500 & X_j-X_i>1500 
alt_DEF_gap_1500_3 <-glm(deficittaxop1~alphincDEFd2_1500+betaincDEFd2_1500+DEFi1_1500+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1500_3 <- mod.sel(org_DEF_3,alt_DEF_gap_1500_3)
summary(vuong_1500_3)

# Artificial gap of X_i-X_j>1750 & X_j-X_i>1750 
alt_DEF_gap_1750_3 <-glm(deficittaxop1~alphincDEFd2_1750+betaincDEFd2_1750+DEFi1_1750+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1750_3 <- mod.sel(org_DEF_3,alt_DEF_gap_1750_3)
summary(vuong_1750_3)


# Progessive tax share experiment 
# French Panel 

# Artificial gap of X_i-X_j>500 & X_j-X_i>500 
alt_TSH_gap_500_3 <-glm(taxshareop1_d~alphincTSHd2_500+betaincTSHd2_500+TSHi1_500+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
org_TSH_3 <-glm(taxshareop1_d~alphincTSHd2+betaincTSHd2+TSHi1+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_500_3 <- mod.sel(org_TSH_3,alt_TSH_gap_500_3)
summary(vuong_500_3)


# Artificial gap of X_i-X_j>750 & X_j-X_i>750 
alt_TSH_gap_750_3 <-glm(taxshareop1_d~alphincTSHd2_750+betaincTSHd2_750+TSHi1_750+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_750_3 <- mod.sel(org_TSH_3,alt_TSH_gap_750_3)
summary(vuong_750_3)


# Artificial gap of X_i-X_j>1000 & X_j-X_i>1000 
alt_TSH_gap_1000_3 <-glm(taxshareop1_d~alphincTSHd2_1000+betaincTSHd2_1000+TSHi1_1000+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1000_3 <- mod.sel(org_TSH_3,alt_TSH_gap_1000_3)
summary(vuong_1000_3)


# Artificial gap of X_i-X_j>1250 & X_j-X_i>1250 
alt_TSH_gap_1250_3 <-glm(taxshareop1_d~alphincTSHd2_1250+betaincTSHd2_1250+TSHi1_1250+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1250_3 <- mod.sel(org_TSH_3,alt_TSH_gap_1250_3)
summary(vuong_1250_3)

# Artificial gap of X_i-X_j>1500 & X_j-X_i>1500 
alt_TSH_gap_1500_3 <-glm(taxshareop1_d~alphincTSHd2_1500+betaincTSHd2_1500+TSHi1_1500+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1500_3 <- mod.sel(org_TSH_3,alt_TSH_gap_1500_3)
summary(vuong_1500_3)

# Artificial gap of X_i-X_j>1750 & X_j-X_i>1750 
alt_TSH_gap_1750_3 <-glm(taxshareop1_d~alphincTSHd2_1750+betaincTSHd2_1750+TSHi1_1750+collegegradp+female+ageyears,data=Frenchdata,family=binomial(link=probit))
vuong_1750_3 <- mod.sel(org_TSH_3,alt_TSH_gap_1750_3)
summary(vuong_1750_3)

sink()
